package controller

import (
	"github.com/gin-gonic/gin"
	"kf/models/dao"
	"kf/ws"
)

type MainController struct {
	//SysUserDao    *dao.UsersDao
	VisitorDao *dao.VisitorsDao
	MessageDao *dao.MessageDao
}

func (mainController *MainController) GetStatistics(c *gin.Context) {
	visitors := mainController.VisitorDao.CountVisitors()
	message := mainController.MessageDao.CountMessage(nil, nil)
	session := len(ws.ClientList)
	kefuNum := 0
	c.JSON(200, gin.H{
		"code": 200,
		"msg":  "ok",
		"result": gin.H{
			"visitors": visitors,
			"message":  message,
			"session":  session + kefuNum,
		},
	})
}
